use crate::{int, vec};
use std::io::stdin;

pub fn read_int() -> int {
    let mut input = String::new();
    stdin().read_line(&mut input).expect("Failed to read line");
    input.trim().parse::<int>().expect("Invalid integer input")
}

pub fn read_vec() -> vec<int> {
    let mut input = String::new();
    stdin().read_line(&mut input).expect("Failed to read line");

    let mut res = vec::new();
    for i in input
        .trim()
        .split_whitespace()
        .map(|s| s.parse::<int>().expect("Invalid integer in std::vector"))
    {
        res.push(i);
    }
    res
}

pub fn read_2() -> (int, int) {
    let v = read_vec();
    (v[0], v[1])
}

pub fn read_3() -> (int, int, int) {
    let v = read_vec();
    (v[0], v[1], v[2])
}

pub fn read_4() -> (int, int, int, int) {
    let v = read_vec();
    (v[0], v[1], v[2], v[3])
}
